package cn.lp207663436.dynamicmanager.config;

import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.annotation.Resource;

/**
 * @author luopeng
 * @date 2023/7/4 13:41:08
 * @email lp207663436@foxmail.com
 */
@Primary
@Configuration
public class CustomDataSourceAutoConfiguration {

    @Bean
    @Resource
    public DynamicDataSourceProvider jdbcDynamicDataSourceProvider(DynamicDataSourceProperties dynamicDataSourceProperties) {
        return new CustomDynamicDataSourceProvider(dynamicDataSourceProperties);
    }
}
